import Abstract from '../abstract';

class videoAPI extends Abstract {

    VideoList(data?: any) {
        return this.getReq({url: 'Video.video'});
    }

    addVideo(data: { name: string; sort?: any }) {
        return this.postReq({url: 'Video.video_add', data});
    }

    getVideoDetail(data: { id: string; }) {
        return this.getReq({url: 'Video.video_detail', params: data});
    }

    editVideo(data: any) {
        return this.postReq({url: 'Video.video_edit', data});
    }

    deleteVideo(data: { id: string }) {
        return this.getReq({url: 'Video.video_delete', params: data});
    }

    getCategoryVideoList(data: { id: string }) {
        return this.getReq({url: 'Video.video_categoryVideoList', params: data});
    }

    addVideoCategory(data: { videoId: string, categoryId: string }) {
        return this.postReq({url: 'Video.video_addCategory', data});
    }

    deleteCategory(data: { videoId: string, categoryId: string }) {
        return this.postReq({url: 'Video.video_deleteCategory', data});
    }
}

// 单列模式返回对象
let instance;
export default (() => {
    if (instance) return instance;
    instance = new videoAPI();
    return instance;
})();
